{include file="public/header" /}
<span class="layui-breadcrumb">
	<a href="javascript:;">其他</a>
	<a><cite>国家搜索信息</cite></a>
</span>
<div class="layui-fluid">
	<div class="layui-card">
		<div class="layui-card-body">
			<div style="color:#FF5722">搜索数据默认展示为当前月份数据</div>
			<div class="layui-form">
				<div style="width:48%;float:left;margin-top:10px">
					<div>回撤搜索结果：</div>
					<div class="layui-inline" style="padding:2px">
						<label class="layui-form-label">请选择范围</label>
						<div class="layui-input-inline" style="min-width:380px">
							<input type="text" class="layui-input" id="rang1" placeholder="开始 到 结束"  autocomplete="off" >
						</div>
						<button type='button' class="layui-btn" onclick="searrang(1)">搜索</button>
					</div>
					<table class="layui-hide" id="test1"></table>
				</div>
				<div style="width:48%;float: right;margin-top:10px">
					<div>搜索无结果排名：</div>
					<div class="layui-inline" style="padding:2px">
						<label class="layui-form-label">请选择范围</label>
						<div class="layui-input-inline" style="min-width:380px">
							<input type="text" class="layui-input" id="rang2" placeholder="开始 到 结束"  autocomplete="off" >
						</div>
						<button type='button' class="layui-btn" onclick="searrang(2)">搜索</button>
					</div>
					<div style="clear:both"></div>
					<table class="layui-hide" id="test2"></table>
				</div>
				<div style="clear:both"></div>
				<div style="width:48%;float:left;margin-top:10px">
					<div>预览页左侧点击数据：</div>
					<div class="layui-inline" style="padding:2px">
						<label class="layui-form-label">请选择范围</label>
						<div class="layui-input-inline" style="min-width:380px">
							<input type="text" class="layui-input" id="rang3" placeholder="开始 到 结束"  autocomplete="off" >
						</div>
						<button type='button' class="layui-btn" onclick="searrang(3)">搜索</button>
					</div>
					<div style="clear:both"></div>
					<table class="layui-hide" id="test3" lay-filter="test"></table>
				</div>
				<div style="width:48%;float:right;margin-top:10px">
					<div>预览页右侧点击数据：</div>
					<div class="layui-inline" style="padding:2px">
						<label class="layui-form-label">请选择范围</label>
						<div class="layui-input-inline" style="min-width:380px">
							<input type="text" class="layui-input" id="rang4" placeholder="开始 到 结束" autocomplete="off"  >
						</div>
						<button type='button' class="layui-btn" onclick="searrang(4)">搜索</button>
					</div>
					<div style="clear:both"></div>
					<table class="layui-hide" id="test4"></table>
				</div>

				
				<div style="clear: both;"></div>

			</div>

		</div>
	</div>
</div>

{include file="/public/footer" /}
<script>
	var table;
	var laydate;

    function searrang(id) {
		var rang = $.trim($('#rang'+id).val());
		if (rang == '') {
			var start = '';
			var end = '';
		}else{
            var start = $.trim(rang.split(" - ")[0]);
		    var end =$.trim(rang.split(" - ")[1]);
		}

		table.reload('test'+id, {
			url: '/admin/Searchc/get_result_c/',
			where: { //设定异步数据接口的额外参数，任意设
				'start': start ,'end': end
			 },
		}); 
	}


	layui.use(['table', 'laydate'], function() {
		table = layui.table;
		laydate = layui.laydate;
        
        table.render({
		    elem: '#test1'
		    ,url: '/admin/Searchc/get_result_c/'
		    ,where: {start: '', end: '', fields: 'sou'}
		    ,cols: [[
		      {field:'country', width:80, title: '国家'}
		      ,{field:'b', width:80, title: '次数'}
		      ,{field:'str', title: '搜索词(前十)'}
		      ,{fixed: 'right', title:'操作',width:70, templet: function(res){
		        var str='<a class="layui-btn layui-btn-xs" target="_blank" href="{:url("Searchc/get_result_xsl")}?country='+res.country+'&starts_time='+res.starts_time+'&end_time='+res.end_time+'&fields=sou">查看</a>';
		        return str;  
		      }}
		    ]]
		    ,loading: true
		    ,page: true
		    ,height: 470
		 });
        table.render({
		    elem: '#test2'
		    ,url: '/admin/Searchc/get_result_c/'
		    ,where: {start: '', end: '', fields: 'noresult'}
		    ,cols: [[
		      {field:'country', width:80, title: '国家'}
		      ,{field:'b', width:80, title: '次数'}
		      ,{field:'str', title: '搜索词(前十)'}
		      ,{fixed: 'right', title:'操作',width:70, templet: function(res){
		        var str='<a class="layui-btn layui-btn-xs" target="_blank" href="{:url("Searchc/get_result_xsl")}?country='+res.country+'&starts_time='+res.starts_time+'&end_time='+res.end_time+'&fields=noresult">查看</a>';
		        return str;
		      }}
		    ]]
		    ,loading: true
		    ,page: true
		    ,height: 470
		 });
        table.render({
		    elem: '#test3'
		    ,url: '/admin/Searchc/get_result_c/'
		    ,where: {start: '', end: '', fields: 'leftclick'}
		    ,cols: [[
		      {field:'country', width:80, title: '国家'}
		      ,{field:'b', width:80, title: '次数'}
		      ,{field:'str', title: '点击词(前十)'}
		      ,{fixed: 'right', title:'操作',width:70, templet: function(res){
		       var str='<a class="layui-btn layui-btn-xs" target="_blank" href="{:url("Searchc/get_result_xsl")}?country='+res.country+'&starts_time='+res.starts_time+'&end_time='+res.end_time+'&fields=leftclick">查看</a>'; 
		        return str;  
		      }}
		    ]]
		    ,loading: true
		    ,page: true
		    ,height: 470
		 });
        table.render({
		    elem: '#test4'
		    ,url: '/admin/Searchc/get_result_c/'
		    ,where: {start: '', end: '', fields: 'rightclick'}
		    ,cols: [[
		      {field:'country', width:80, title: '国家'}
		      ,{field:'b', width:80, title: '次数'}
		      ,{field:'str', title: '点击词(前十)'}
		      ,{fixed: 'right', title:'操作',width:70, templet: function(res){
		        var str='<a class="layui-btn layui-btn-xs" target="_blank" href="{:url("Searchc/get_result_xsl")}?country='+res.country+'&starts_time='+res.starts_time+'&end_time='+res.end_time+'&fields=rightclick">查看</a>'; 
		        return str;  
		      }}
		    ]]
		    ,loading: true
		    ,page: true
		    ,height: 470
		 });

		laydate.render({
			elem: '#rang1',
			type: 'date',
			range: true,
		});
		laydate.render({
			elem: '#rang2',
			type: 'date',
			range: true,
		});
		laydate.render({
			elem: '#rang3',
			type: 'date',
			range: true,
		});
		laydate.render({
			elem: '#rang4',
			type: 'date',
			range: true,
		});
	});
    function dao_xsl(country,starts_time,end_time,fields){
      $.post('/admin/Searchc/get_result_xsl/',{country:country,starts_time:starts_time,end_time:end_time,fields:fields},function(res){

      })
    }
</script>
